﻿using System;
using ExtraClub.Domain;
using System.Configuration;
using System.Web.Configuration;
using ExtraClub.Domain.Entity;
using System.Web.UI.WebControls;

namespace ExtraClub.Web.Modules.dashboard {
    public partial class module : BaseModule {
        protected ExtraClub.Domain.Entity.Menu MainMenu = null;
        protected override void OnLoad(EventArgs e) {
            base.OnLoad(e);
            BuildMenu();
        }
        private void BuildMenu() {
            MainMenu = ExtraClub.Domain.Entity.Menu.GetCurrentMenu();
            string uri = MainMenu.Items[0].Id; ;

            if (Request.QueryString.Count > 0 && Request.QueryString["view"] != null) {
                int view = int.Parse(Request.QueryString["view"]);
                uri = MainMenu.Items[view].Id;
            }
            ModuleContainer.Controls.Add(Page.LoadControl(ResolveUrl(string.Format(Constants.WEB_CONTROLS_PATH, uri))));
        }
    }
}
